using System;
using UnityEngine;

namespace Voodoo.Sauce.Core
{
	[Serializable]
	public class SubscriptionInfoContainer : ISerializationCallbackReceiver
	{
		public static readonly string SubscriptionFilePath = Application.persistentDataPath + "/subscriptions/";

		[SerializeField]
		private long _lPurchaseDate;

		[SerializeField]
		private long _lIntroductoryPricePeriod;

		[SerializeField]
		private long _lExpireDate;

		[SerializeField]
		private long _lCancelDate;

		[SerializeField]
		private long _lFreeTrialPeriod;

		[SerializeField]
		private long _lSubscriptionPeriod;

		public string productId;

		public SubscriptionResult isSubscribed;

		public SubscriptionResult isExpired;

		public SubscriptionResult isCancelled;

		public SubscriptionResult isFreeTrial;

		public SubscriptionResult isAutoRenewing;

		public SubscriptionResult isIntroductoryPricePeriod;

		public string introductoryPrice;

		public long introductoryPricePeriodCycles;

		public string freeTrialPeriodString;

		public string skuDetails;

		public string subscriptionInfoJson;

		[NonSerialized]
		public DateTime cancelDate;

		[NonSerialized]
		public DateTime expireDate;

		[NonSerialized]
		public TimeSpan freeTrialPeriod;

		[NonSerialized]
		public TimeSpan introductoryPricePeriod;

		[NonSerialized]
		public DateTime purchaseDate;

		[NonSerialized]
		public TimeSpan subscriptionPeriod;

		public void OnBeforeSerialize()
		{
			_lPurchaseDate = purchaseDate.Ticks;
			_lIntroductoryPricePeriod = introductoryPricePeriod.Ticks;
			_lExpireDate = expireDate.Ticks;
			_lCancelDate = cancelDate.Ticks;
			_lFreeTrialPeriod = freeTrialPeriod.Ticks;
			_lSubscriptionPeriod = subscriptionPeriod.Ticks;
		}

		public void OnAfterDeserialize()
		{
			purchaseDate = new DateTime(_lPurchaseDate);
			introductoryPricePeriod = new TimeSpan(_lIntroductoryPricePeriod);
			expireDate = new DateTime(_lExpireDate);
			cancelDate = new DateTime(_lCancelDate);
			freeTrialPeriod = new TimeSpan(_lFreeTrialPeriod);
			subscriptionPeriod = new TimeSpan(_lSubscriptionPeriod);
		}

		public static void ClearSavedSubscriptionInfo()
		{
		}
	}
}
